<?php
function db_connect(){
    global $conn;
    if (isset($conn)) return $conn;
    
    @$conn=new mysqli('192.168.1.16','asterisk','asteriskpass','asterisk');
    //@$conn=new mysqli('localhost','root','','phonebook');
    if (mysqli_connect_errno()) {
        return false;
    } else {
        return $conn;
    }
}

?>